import Vue from 'vue'
import '../imports/ui/plugins'
import App from '../imports/ui/App.vue'
import '../public/font/iconfont';
import VueMeteorTracker from 'vue-meteor-tracker'; 
import Vant from 'vant';
import 'vant/lib/index.css';
import './vant-important';
import router from "./router";
import '../public/font/iconfont.css';


Vue.use(Vant);
Vue.use(VueMeteorTracker);  
Vue.config.silent = true

router.beforeEach((to, from, next) => {
  if (sessionStorage.getItem('user')) {
    if (to.path == '/login'&&to.path=='/register') {
     next('/home');
    } else {
     next();
    }
   } else {
    if (to.path == '/login'||to.path=='/register') {
     next();
    } else {
     next('/login');
    }
   }
});

Meteor.startup(() => {
  new Vue({
    el: '#app',
    ...App,
    router
  })
})
